package org.leviatan.dataharbour.core.model.control;

import org.leviatan.dataharbour.core.model.DataEntity;
import org.leviatan.dataharbour.core.model.DataSource;
import org.leviatan.dataharbour.core.model.HarbourRequest;
import org.leviatan.dataharbour.core.model.PersistenceResource;
import org.leviatan.dataharbour.core.model.Sender;
import org.leviatan.dataharbour.core.model.XmlConvertible;

public abstract class GenericModelXmlHandler {
	
	public static String convertToXml(XmlConvertible xmlObj) {
		
		String xmlResult = null;
		
		if (xmlObj instanceof DataEntity) {
			xmlResult = DataEntityHandler.convertToXml((DataEntity) xmlObj);
			
		} else if (xmlObj instanceof DataSource) {
			xmlResult = DataSourceHandler.convertToXml((DataSource) xmlObj);
			
		} else if (xmlObj instanceof HarbourRequest) {
			xmlResult = HarbourRequestHandler.convertToXml((HarbourRequest) xmlObj);
			
		} else if (xmlObj instanceof PersistenceResource) {
			xmlResult = PersistenceResourceHandler.convertToXml((PersistenceResource )xmlObj);
			
		} else if (xmlObj instanceof Sender) {
			xmlResult = SenderHandler.convertToXml((Sender) xmlObj);
			
		}
		
		return xmlResult;
	}

	
}
